InĀ [1]:
import sys
import os
src_path = os.path.abspath(os.path.join(os.getcwd(), "..", "src"))
if src_path not in sys.path:
sys.path.insert(0, src_path)
from plots import plot_plotly, preprocessing_results
InĀ [2]:
# experiment 1, local epochs 3 local concept drift
local_FedCluLearn = 'results/results_FedCluLearn_2025-02-05_11_02_47.756245.txt'
global_FedCluLearn = 'results/global_model_evaluation_FedCluLearn_2025-02-05_11_02_47.756245.txt'
local_FedAvg = 'results/results_FedAvg_2025-02-05_11_02_59.570648.txt'
global_FedAvg = 'results/global_model_evaluation_FedAvg_2025-02-05_11_02_59.570648.txt'
local_FedAtt = 'results/results_FedAtt_2025-02-15_14_24_24.188745.txt'
global_FedAtt = 'results/global_model_evaluation_FedAtt_2025-02-15_14_24_24.188745.txt'
local_FedProx = 'results/results_FedProx_2025-02-16_08_55_52.957901.txt'
global_FedProx = 'results/global_model_evaluation_FedProx_2025-02-16_08_55_52.957901.txt'
local_FedCluLearn_Prox = 'results/results_FedCluLearn_Prox_2025-02-26_12_05_46.452219.txt'
global_FedCluLearn_Prox = 'results/global_model_evaluation_FedCluLearn_Prox_2025-02-26_12_05_46.452219.txt'
InĀ [3]:
local_filenames = [local_FedCluLearn, local_FedAvg, local_FedAtt, local_FedProx, local_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
InĀ [4]:
mse_column = 'mse'
n_rounds, y = preprocessing_results(filenames=local_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title='Avg MSE Local models', y_axis_title=f'{mse_column.upper()} error', y_axis_max=0.3)
InĀ [5]:
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=local_filenames, client_id=client_id, mse_column='mse')
plot_plotly(n_rounds, y, title=f'MSE Local model Client {client_id}', y_axis_title='MSE error')
InĀ [6]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
# global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
#Avg {mse_column.upper()} Global model
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [7]:
mse_column = 'r2'
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [8]:
mse_column='mse'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [9]:
mse_column='r2'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [10]:
mse_column='mse'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=[local_FedCluLearn, global_FedCluLearn, None, None, None], client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Local vs Global Client {client_id}', y_axis_title=f'{mse_column} error', algo_name1='Local FedCluLearn', algo_name4='Global FedCluLearn')